package iedcyt.acute.controller.listeners.document;

import iedcyt.acute.model.DocumentModel;
import iedcyt.acute.model.DocumentModel;
import iedcyt.acute.view.DocumentView;
import iedcyt.acute.view.DocumentView;
import iedcyt.acute.view.ViewUtils;

import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.TableItem;

public class AuthorsKeyDownListener implements Listener {

	private DocumentModel _model;
	private DocumentView _view;
	
	public AuthorsKeyDownListener(DocumentView view, DocumentModel model) {
		this._model = model;
		this._view = view;
	}
	
	public void handleEvent(Event event) {
		
		Integer idAu = _model.getSelected_IdAuthor();
		
		char press = ("" + event.character).toLowerCase().toCharArray()[0];
		
		if (idAu != null)
		{
		//al pulsar 'a' se abre el documento
		if (press == 'a')
		{
			
			ViewUtils.getInstance().openAuthorView(idAu);
		}
		}
		
	}
}
